Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ylru

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ylru

Extends LRU base on hashlru

  • 1.4.0
  • release-1.x
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6M
increased by1.59%
Maintainers
3
Weekly downloads
 
Created

What is ylru?

The ylru package is a simple and efficient LRU (Least Recently Used) cache implementation in JavaScript. It is designed to help manage a cache of items with a fixed size, automatically removing the least recently used items when the cache exceeds its capacity. This is particularly useful in applications where memory management and data retrieval efficiency are critical.

What are ylru's main functionalities?

Create and manage an LRU cache

This feature allows the user to create a cache with a specified limit and perform basic operations such as setting, getting, checking, and deleting items, as well as retrieving the size of the cache.

const YLRU = require('ylru');
let cache = new YLRU(100); // Create a cache that can hold 100 items
// Set items in the cache
cache.set('key1', 'value1');
cache.set('key2', 'value2');
// Get an item from the cache
let value = cache.get('key1'); // returns 'value1'
// Check if a key exists in the cache
let exists = cache.has('key1'); // returns true
// Remove an item from the cache
cache.delete('key2');
// Get the number of items in the cache
let size = cache.size(); // returns 1

Other packages similar to ylru

FAQs

Package last updated on 28 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc